package com.ps.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;

import com.ps.dao.BaseDaoSupport;
import com.ps.entity.Result;

public interface BaseService<T> {
	public boolean exists(Integer id);
	
	public Result findById(Integer id);
	
	public Result findAll();
	
	public Result save(T object);
	
	public Result update(T object);
	
	public void flush();
	
	public Result delete(T object);
	
	public Result delete(Integer id);
	
	
	public Result findByCriteria(final DetachedCriteria detachedCriteria );
	
	public Result findPageByCriteria(final DetachedCriteria detachedCriteria, final int pageSize,final int startIndex,final List<Order> orderList);
	
	public Result findPageByCriteria(final DetachedCriteria detachedCriteria,
			final int pageSize,final int startIndex,final Order order);
	
	public Result saveOrUpdate(final T object);
	
	public Result findByProperty(String propertyName, Object value);
	
	public int getCountByProperty(String propertyName);
	
	public int getCountByProperty(String propertyName, Object value);

	public  BaseDaoSupport<T> getBaseDao();
	

}
